package com.atguigu.gulimall.member.web;

import com.alibaba.fastjson.JSON;
import com.atguigu.common.utils.R;
import com.atguigu.gulimall.member.feignService.OrderFeignService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.HashMap;

/**
 * @author guoch0613@163.com
 * @Description
 * @create 2021-05-15 22:34
 */
@Controller
public class MemberWebController {

    @Autowired
    OrderFeignService orderFeignService;

    @GetMapping("/memberOrder.html")
    public String memberOrderPage(Model model,@RequestParam(value = "pageNum",defaultValue = "1") Integer pageNum) {
        HashMap<String, Object> map = new HashMap<>();
        map.put("page",pageNum.toString());
        R r = orderFeignService.listWithItem(map);
        System.out.println("接收到的数据"+JSON.toJSONString(r));
        model.addAttribute("orders",r);
        return "orderList";
    }
}
